#/usr/bin/env python

"first project test"
import sys
#import Tkinter

def fib(n):    # write Fibonacci series up to n
    """Print a Fibonacci series up to n."""
    a, b = 0, 1
    while a < n:
        print a,
        a, b = b, a+b
    print

def ask_ok(prompt, retries=4, complaint='Yes or no, please!'):
    while True:
        ok = raw_input(prompt)
        print ok
        if ok in ['y', 'ye', 'yes']:
            return True
        if ok in ('n', 'no', 'nop', 'nope'):
            return False
        retries = retries - 1
        if retries < 0:
            raise OSError('uncooperative user')
        print(complaint)

# Now call the function we just defined:
fib(2000)

ask_ok('Do you really want to quit?')
ask_ok('Do you really want to quit?', complaint='nihao')

